package com.shaolei.client;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

import com.shaolei.basic.BASIC_QQ;
import com.shaolei.client_thread.Client_in;
import com.shaolei.client_thread.Client_out;
import com.shaolei.client_thread.System_in;

public class TCPEchoClient extends BASIC_QQ{
	public static void main(String [] args) throws Exception {
		Socket socket=new Socket(new TCPEchoClient().get_server(),new TCPEchoClient().get_servPort());
		InputStream in = socket.getInputStream();
		OutputStream out = socket.getOutputStream();
		
		//create threads
		Client_in read1= new Client_in(in);
		Thread read= new Thread(read1);
		
		Client_out write1= new Client_out(out);
		Thread write= new Thread(write1);
		
		System_in input1= new System_in();
		Thread input= new Thread(input1);
		
		read.start();
		write.start();
		input.start();
		write.join();
		socket.close();
	}
}
